package cn.swust.score.util;

import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

public class CustomPasswordEncoder implements PasswordEncoder  {
	 @Override
	    public String encode(CharSequence rawPassword) {
	        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
	        return encoder.encodePassword(rawPassword.toString(), "lhz");
	    }
	    @Override
	    public boolean matches(CharSequence rawPassword, String encodedPassword) {
	        Md5PasswordEncoder encoder = new Md5PasswordEncoder();
	        return encoder.isPasswordValid(encodedPassword, rawPassword.toString(), "hongxf");
	    }
}